<template>
    <div>
        <Modal width="800"
               v-model="menuUpdate.menuFlag"
               @on-ok="ok"
               @on-cancel="cancel"
               draggable
               scrollable
               title="菜单更新">
            <Form :label-width="90">
                <FormItem label="菜单级别:">
                    <RadioGroup v-model="menudo.menuLevel">
                        <Radio label=1>一级菜单</Radio>
                        <Radio label=2>二级菜单</Radio>
                        <Radio label=3>功能按钮</Radio>
                    </RadioGroup>
                </FormItem>
                <FormItem v-if="menudo.menuLevel!=3" label="菜单序号:">
                    <Input v-model="menudo.mark" />
                </FormItem>
                <FormItem v-if="menudo.menuLevel!=1" label="菜单父序号:">
                    <Input v-model="menudo.fatherMark" />
                </FormItem>
                <FormItem label="菜单名称:">
                    <Input v-model="menudo.menuName" />
                </FormItem>
                <FormItem v-if="menudo.menuLevel!=3" label="菜单图标:">
                    <Input v-model="menudo.menuIcon" />
                </FormItem>
                <FormItem v-if="menudo.menuLevel!=3" label="路由路径:">
                    <Input v-model="menudo.routerPath" />
                </FormItem>
                <FormItem v-if="menudo.menuLevel==2" label="页面路径:">
                    <Input v-model="menudo.routerUrl" />
                </FormItem>
            </Form>
        </Modal>
    </div>
</template>

<script>
    export default {
        data(){
            return{
                menudo:{
                    menuLevel:0
                }
            }
        },
        watch:{
            'menuUpdate.menuFlag'(){
                this.menudo = this.menuUpdate.menudo
            }
        },
        props:{
            menuUpdate:{}
        },
        methods:{
            ok(){
                this.http.post("/menu/saveMenuUpdate",this.qs.stringify(this.menudo)).then(res=>{
                    if(res.data){
                        this.$Message.success("操作成功！！！")
                        this.$parent.getAllMenu()

                    }else {
                        this.$Message.error("保存出错啦！！！")

                    }
                } )
            },
            /**
             * 点击了关闭
             */
            cancel(){

            }
        }
    }
</script>

<style scoped>

</style>
